import { requestHasToken as request } from '../util/server';

// 新建知识
const createKnowledge = knowledge => {
  return request({
    url: '/TbKnowledge/addTbKnowledge',
    method: 'post',
    data: knowledge
  })
};
// 新建测评结果模板
const createResultTemplate = template => {
  return request({
    url: '/resultTemplate/add',
    method: 'post',
    data: template
  })
};
// 分页查询结果模板
const getResultTemplateList = query => {
  return request({
    url: '/resultTemplate/queryPage',
    method: 'post',
    data: query
  })
};
// 修改结果模板
const updateResultTemplate = template => {
  return request({
    url: '/resultTemplate/updateResultTemplate',
    method: 'put',
    data: template
  })
};
// 删除结果模板
const deleteResultTemplate = templateId => {
  return request({
    url: `/resultTemplate/deleteById/${templateId}`,
    method: 'delete'
  })
};
// 获取所有心理测试表
const getAllMentalList = type => {
  return request({
    url: '/tbpsychologytitle/queryAll/' + type,
    method: 'get'
  })
};
// 添加医院测试表
const addHospitalChart = chart => {
  return request({
    url: '/TbHospitalPsychology/createTbHospitalPsychology',
    data: chart,
    method: 'post'
  })
};
// 修改医院测试表
const updateHospitalChart = chart => {
  return request({
    url: '/TbHospitalPsychology/updateTbHospitalPsychology',
    method: 'put',
    data: chart
  })
};
// 删除医院测试表
const deleteHospitalChart = id => {
  return request({
    url: `/TbHospitalPsychology/deleteById/${id}`,
    method: 'delete'
  })
};
// 根据医院id查询量表
const getHospitalList = hospitalId => {
  return request({
    url: `/TbHospitalPsychology/queryHospitalId/${hospitalId}`,
    method: 'get'
  })
};
// 修改医院量表状态
const changeHospitalChartStatus = id => {
  return request({
    url: `/TbHospitalPsychology/updateEnable/${id}`,
    method: 'get'
  })
};
//#region 提现
// 查询提现记录
const getWithDrawRecord = queryData => {
  return request({
    url: '/withdrawDeposit/queryPage',
    method: 'post',
    data: queryData
  })
};
// 更改提现记录状态
const changeWithDrawStatus = withDraw => {
  return request({
    url: '/withdrawDeposit/updateTbWithdrawDeposit',
    method: 'put',
    data: withDraw
  })
}


//#endregion


export {
  createKnowledge,
  createResultTemplate,
  getResultTemplateList,
  updateResultTemplate,
  deleteResultTemplate,
  getAllMentalList,
  addHospitalChart,
  updateHospitalChart,
  deleteHospitalChart,
  getHospitalList,
  changeHospitalChartStatus,
  getWithDrawRecord,
  changeWithDrawStatus
}
